package com.hctrl.mybatis.metaObject.handler;

import ch.qos.logback.core.util.DatePatternToRegexUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import org.apache.log4j.pattern.DatePatternConverter;

import java.text.DateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * @author hanchao
 * @version 1.0
 * @date 2022/5/24 23:03
 */
public class LocalDateTypeHandler implements TypeHandler<LocalDate> {

    @Override
    public LocalDate typeReplacement(String value) {
        LocalDate parse = LocalDate.parse(value, DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
        return parse;
    }

    @Override
    public Boolean support(Class<?> type) {
        return type.equals(LocalDate.class);
    }
}
